package bookpos.dao;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import bookpos.entity.Orders;
import bookpos.util.core.dao.HibernateDao;
import bookpos.vo.MonthLedger;
@Repository
public class OrdersDao extends HibernateDao<Orders> {

	public List<MonthLedger> findBySQLMonthLedger(String sql) {
		List<Object[]> q = getCurrentSession().createSQLQuery(sql).list();
		List<MonthLedger> _list = new ArrayList<MonthLedger>();
		for(int i = 0; i < q.size(); i++){
			MonthLedger m = new MonthLedger();
			m.setNumber("7月份");
			m.setNumber(q.get(i)[0]+"");
			m.setTotal(q.get(i)[1]+"");
			_list.add(m);
		}
		return _list;
	}
	
	//select btid,bookname,type_name,i.quantity,i.total,sum(i.quantity),sum(total) from bookpos_order_item i,bookpos_book b,bookpos_book_type t where i.bid=b.id and t.id=b.btid group by b.btid;
}
